<div class="layui-form-item" id="videoUp">
    <input name="video" id="videourl"  value="" autocomplete="off" class="layui-input" type="hidden">
    <div class=" layui-upload-drag" id="video"  type="video">
        <i class="layui-icon">&#xe654;</i>
        <p>点击上传</p>
        <video id="demo9" src="" style="position: absolute;height: 137px;width: 137px;margin: -106px auto auto -60px;"/>
    </div>
</div>
<script>
    $(function(){
        layui.use('upload', function(){
            var $ = layui.jquery
                ,upload = layui.upload;
            //上传视频
            var uploadInst=upload.render({
                elem: '#video'
                ,url: '{{URL::action('Api\UploadController@upload')}}'
                ,field:"file"
                ,data:{"dir":"media"}
                ,accept: 'video' //视频
                ,done: function(res){
                    if(res.code==200){
                        $("#videourl").val(res.data.id);
                        $("#demo9").attr("src",res.data.url);
                        layer.alert("上传成功",{offset:['200px','450px'],icon:6});
                    }
                }
                ,error:function () {
                    //演示失败状态，并实现重传
                    var demoText = $('#demoText');
                    demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                    demoText.find('.demo-reload').on('click', function () {
                        uploadInst.upload();
                    });
                }
            });
        });
    })
</script>